package com.example._01helloword.filter;


import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

//编写过滤器类
public class MyFilter implements Filter {
    @Override
    public void init(FilterConfig arg0) throws ServletException {
        Filter.super.init(arg0);
    }

    @Override
    public void doFilter(ServletRequest srequest, ServletResponse sresponse, FilterChain filterChain)
            throws IOException, ServletException {
        // TODO Auto-generated method stub
        HttpServletRequest request = (HttpServletRequest) srequest;
        System.out.println("执行过滤,url :"+request.getRequestURI());
        filterChain.doFilter(srequest, sresponse);
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
